<template>
	<view>
		<view class="">
			<u-card v-if="cardShow" :title="title" :sub-title="subTitle" :thumb="thumb">
				<view class="" slot="body">
					<view class="">
						学号：{{stu_id}}
					</view>
					<view class="">
						姓名：{{name}}
					</view>
					<view class="">
						参保信息：<text style="color: #007AFF;">{{info}}</text>
					</view>
					<view class="">
						备注：<text style="color:#ec5651;background-color: #F8F8F8">{{remark}}</text>
					</view>
				</view>
				<!-- <view class="" slot="foot">
					<u-icon name="chat-fill" size="34" color="" label="30评论"></u-icon>
				</view> -->
			</u-card>
			<view class="empty" v-if="emptyShow">
				<u-empty text="无医保信息"></u-empty>
			</view>
			<view class="u-tips" v-if="tipShow">
				<text>提示：已完成参保及缴费的同学不要自行办理停保；在广州市外参保但未缴费的同学请尽快缴费；如需在学校参保请在<text
						style="color: #e96900;background-color: #f8f8f8;border-radius: 2px;padding: 1px;">12月14日前</text>完成已有医保停保，逾时视为自动<text
						style="color: #e96900;background-color: #f8f8f8;border-radius: 2px;padding: 1px;">放弃</text>在校生医保参保。</text>
			</view>
			<view class="u-tips" v-if="tipShow">
				其他疑问请咨询院生活部
			</view>
		</view>
		<!-- <view class="" style="margin-top: 20rpx;padding-left: 40rpx;padding-right: 40rpx;">
			<u-tag text="留言区" type="primary" shape="circle" />
			<u-input style="margin-top: 20rpx;" placeholder="请尽可能描述清楚问题,待我们经过整理后再统一通过生委群答复" v-model="msg" type="textarea" :border="true" :height="120" maxlength="-1" :auto-height="true" />
			<u-button @click="subMsg" style="margin-top: 20rpx;" type="primary" size="medium">提交<u-loading v-show="loadShow" mode="flower"></u-loading></u-button>
			
		</view> -->
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				loadShow:false,
				tipShow:false,
				emptyShow:false,
				cardShow:false,
				title: '医保详情',
				subTitle: '2021-2022年度',
				thumb: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-58e589c3-7f3b-4faf-a66d-24e23e699ae7/129a1dd4-4873-46d9-8e50-218b206d2794.png',
				stu_id:uni.getStorageSync('stu_id'),
				name:'',
				info:'',
				remark:'',
				msg:''
			}
		},
		onLoad() {
			if(!this.stu_id){
				uni.showModal({
					title:'提示',
					content:'获取学号失败,请先在首页绑定'
				})
				return
			}
			uni.showToast({
				icon:'error',
				title:'暂停服务'
			})
			// uni.showLoading({
			// 	title:'请求中'
			// })
			
			// uniCloud.callFunction({
			// 	name:'lifeServices',
			// 	data:{
			// 		action:'yiBaoDetail',
			// 		params:{
			// 			stu_id:this.stu_id
			// 		}
			// 	},
			// 	success: (res) => {
			// 		this.tipShow = true
			// 		if(res.result.data.length == 0){
						
			// 			this.emptyShow = true
			// 			uni.hideLoading()
			// 			return
			// 		}
			// 		this.cardShow = true
			// 		let data = res.result.data[0]
			// 		this.name = data.name
			// 		this.info = data.info
			// 		this.remark = data.remark
					
			// 		uni.hideLoading()
			// 	},
			// 	fail: (err) => {
			// 		uni.hideLoading()
			// 		uni.showModal({
			// 			title:'错误提示',
			// 			content:err
			// 		})
			// 	}
			// })
			
		},
		methods: {
			subMsg(){
				if(!this.msg){
					uni.showToast({
						title:'请输入内容',
						icon:'error'
					})
					return
				}
				this.loadShow = true
				uniCloud.callFunction({
					name:'lifeServices',
					data:{
						action:'yiBaoMsg',
						params:{
							stu_id:this.stu_id,
							content:this.msg
						}
					},
					success: (res) => {
						console.log(res)
						this.loadShow = false
						// this.msg = ''
						if(res.result.id){
							
							uni.showToast({
								title:'提交成功'
							})
						}
					},
					fail: (err) => {
						uni.showModal({
							content:'err'
						})
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.u-card-wrap {
		background-color: $u-bg-color;
		padding: 1px;
	}

	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}

	.u-body-item image {
		width: 120rpx;
		flex: 0 0 120rpx;
		height: 120rpx;
		border-radius: 8rpx;
		margin-left: 12rpx;
	}
	.empty{
		position:absolute;
		top:50%;
		left:50%;
		transform: translate(-50%,-50%);
	}
	.u-tips {
		margin-top: 20rpx;
		padding-left: 40rpx;
		padding-right: 40rpx;
	}
</style>
